package com.tadpole.music.view.widget;

import android.app.Activity;
import android.view.View;
import android.view.animation.Animation;
import android.widget.ImageView;
import android.widget.TextView;

import com.tadpole.music.R;

import razerdp.basepopup.BasePopupWindow;

/**
 * Created By 孙岩
 * on 2020/9/11
 */
public class PayPopupError extends BasePopupWindow implements View.OnClickListener{
    //重新支付
    private TextView tvPay;
    //取消
    private TextView tvCancel;
    //关闭
    private ImageView ivClose;
    private IModeSelection iModeSelection;

    public PayPopupError(Activity context) {
        super(context);
        ivClose = (ImageView) findViewById(R.id.ivClose);
        tvPay = (TextView) findViewById(R.id.tvPay);
        tvCancel = (TextView) findViewById(R.id.tvCancel);
        tvPay.setOnClickListener(this);
        ivClose.setOnClickListener(this);
        tvCancel.setOnClickListener(this);
    }


    @Override
    protected Animation initShowAnimation() {
        return null;
    }

    @Override
    public View getClickToDismissView() {
        return getPopupWindowView();
    }

    @Override
    public View onCreatePopupView() {
        return createPopupById(R.layout.pop_pay_error);
    }

    @Override
    public View initAnimaView() {
        return findViewById(R.id.rlError);
    }

    public void setModeListener(IModeSelection iModeSelection) {
        this.iModeSelection = iModeSelection;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.tvPay:
                iModeSelection.getMode(1);
                break;
            case R.id.ivClose:
                iModeSelection.getMode(2);
                break;
            case R.id.tvCancel:
                iModeSelection.getMode(3);
                break;
        }
    }

    public interface IModeSelection{
        void getMode(int mode);
    }
}

